package com.imclient.swing;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ConnectTest extends JFrame {

	private JPanel contentPane;

	private static boolean isrun = true;
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ConnectTest frame = new ConnectTest();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ConnectTest() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton button = new JButton("\u5F00\u59CB");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				new Thread(){
					
					
					public void run() {
						isrun = true;
						try {
							int i = 100000;
							while(isrun){
								TESTEXample te = new TESTEXample();
								te.start(String.valueOf(i), String.valueOf(i), "push.kanketv.com", 4646);
								i++;
								Thread.sleep(100);
							}
						} catch (Exception e1) {
							e1.printStackTrace();
						}
						
					};
					
				}.start();
				
				
			}
		});
		button.setBounds(33, 52, 93, 23);
		contentPane.add(button);
		
		JButton button_1 = new JButton("\u7ED3\u675F");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				isrun = false;
			}
		});
		button_1.setBounds(263, 52, 93, 23);
		contentPane.add(button_1);
	}
}
